package com.kid.keep.config;

import com.kid.keep.interceptor.HeaderInterceptor;
import com.honeybee.cloud.framework.common.config.AbstractWebConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

/**
 * @Description web配置
 * @Author DELL
 * @Create 2019-04-16
 * @Since 1.0.0
 */
@Configuration
public class WebConfig extends AbstractWebConfig {


    /**
     * token拦截器
     *
     * @return
     */
    @Bean
    public HandlerInterceptor getHeaderInterceptor() {
        return new HeaderInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //增加头部检验拦截器
        registry.addInterceptor(getHeaderInterceptor()).addPathPatterns("/**").excludePathPatterns("/kid-keep/v*/users", "/health");
        super.addInterceptors(registry);
    }

}
